function loginCallback(response)
{
    eval(response);
}
function userLogin()
{
    var xmlhttp   = new Ajax();
    var url1       = "http://localhost/jiajia/nanbeihuo/index.php?controller=users&action=login";
    var username  = $O("username").value; 
    var password  = $O("password").value; 
    var postStr   = "username="+username+"&password="+password;
    xmlhttp.request(url1, "post", false, postStr, loginCallback, emptyFunc,emptyFunc);
    return false;
}
function loginCallback(response)
{
	
	if(response.user == true)
	{
		if(response.password = false)
		{
			alert("密码错误，请重新输入！");
//			document.getElementById("pwErr").innerHTML ="密码错误";
		}

	}
	else if(response.user == false)
	{
		if(response.password == true)
		{
			alert("用户名不存在，请重新输入，如果没有帐号请注册新用户!");
//			document.getElementById("nameErr").innerHTML ="无此用户";
		}
		else
		{
			alert("输入有误，请检查");		
		}
	}
	else
	{
		alert("欢迎"+response.user);
		window.location.href='http://localhost/jiajia/nanbeihuo/index.html';	
	}

}
